package org.poptest.populate;

import java.util.Arrays;

/**
 * Licensed under the Apache License, Version 2.0 (the "License");
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * @author Alan Roche
 *         Date: 20/02/11
 *         Time: 20:57
 */
public class PopulateContext {
    private final Object target;
    private String[] ignoreProperties;

    public PopulateContext(final Object target) {
        this.target = target;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        PopulateContext that = (PopulateContext) o;

        if (!Arrays.equals(ignoreProperties, that.ignoreProperties)) return false;
        if (target != null ? !target.equals(that.target) : that.target != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = target != null ? target.hashCode() : 0;
        result = 31 * result + (ignoreProperties != null ? Arrays.hashCode(ignoreProperties) : 0);
        return result;
    }
}
